import java.awt.BorderLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;
import javax.swing.JFrame;
/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class JFrameInicio extends javax.swing.JFrame {
	//JFrame JFrameEstudiantes = new JFrame();
	private JPanel jPanelSeccion;
	private JLabel lblnroSeccion;
	private JButton jButton1;
	private JButton brAplicarEval;
	private JButton btReportes;
	private JButton btSalir;
	private JButton btEstudiantes;
	private JButton btAsigProf;
	private JButton btOk;
	private JTextField txtnroSeccion;
	private Seccion s = new Seccion();
    
	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				JFrameInicio inst = new JFrameInicio();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public JFrameInicio() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			this.setTitle("Menu Principal");
			{
				jPanelSeccion = new JPanel();
				getContentPane().add(jPanelSeccion, BorderLayout.NORTH);
				GroupLayout jPanelSeccionLayout = new GroupLayout((JComponent)jPanelSeccion);
				jPanelSeccion.setPreferredSize(new java.awt.Dimension(500, 319));
				jPanelSeccion.setLayout(jPanelSeccionLayout);
				jPanelSeccion.setBackground(new java.awt.Color(255,255,255));
				{
					lblnroSeccion = new JLabel();
					lblnroSeccion.setText(" Ingrese el Numero de la seccion: ");
					lblnroSeccion.setFont(new java.awt.Font("Dialog",0,11));
				}
				{
					txtnroSeccion = new JTextField();
				}
				{
					btOk = new JButton();
					btOk.setText("Abrir Seccion");
					btOk.setFont(new java.awt.Font("Bitstream Charter",1,12));
					btOk.setBackground(new java.awt.Color(173,216,230));
					btOk.addMouseListener(new MouseAdapter() {
						public void mouseClicked(MouseEvent evt) {
							System.out.println("btOk.mouseClicked, event="+evt);
							//TODO add your code for btnregistrar.mouseClicked
							//jPanelMenuOpciones
							if(txtnroSeccion.getText().equals(""))
							{
								JOptionPane.showMessageDialog(null, "Ingrese el numero de la seccion");
							}
							else
							{
								s.setNroSeccion(txtnroSeccion.getText());
								btAsigProf.setVisible(true);
							    btEstudiantes.setVisible(true);
							    btReportes.setVisible(true);
							    btSalir.setVisible(true);
							    brAplicarEval.setVisible(true);
							    lblnroSeccion.setVisible(false);
							    txtnroSeccion.setVisible(false);
							    btOk.setVisible(false);
							}
							
						}
					});
				}
				{
					btAsigProf = new JButton();
					btAsigProf.setText("Asignar Profesor");
					btAsigProf.setVisible(false);
					btAsigProf.addMouseListener(new MouseAdapter() {
						public void mouseClicked(MouseEvent evt) {
							System.out.println("btAsigProf.mouseClicked, event="+evt);
							//TODO add your code for btnregistrar.mouseClicked
							JFrameProfesor PantallaProfesor = new JFrameProfesor();
							PantallaProfesor.setVisible(true);
							//JFrameInicio.setVisible(false);
						}
					});
					
				}
				{
					btEstudiantes = new JButton();
					btEstudiantes.setText("Administar Estudiantes");
					btEstudiantes.setVisible(false);
					btEstudiantes.addMouseListener(new MouseAdapter() {
						public void mouseClicked(MouseEvent evt) {
							System.out.println("btEstudiantes.mouseClicked, event="+evt);
							//TODO add your code for btnregistrar.mouseClicked
							JFrameEstudiante PantallaEstudiante = new JFrameEstudiante();
							PantallaEstudiante.setVisible(true);
							//JFrameInicio.setVisible(false);
						}
					});
					//adminStu.setVisible(true);
				}
				{
					btSalir = new JButton();
					btSalir.setText("Salir");
					btSalir.setVisible(false);
					btSalir.addMouseListener(new MouseAdapter() {
						public void mouseClicked(MouseEvent evt) {
							System.out.println("btSalir.mouseClicked, event="+evt);
							//TODO add your code for btnregistrar.mouseClicked
							System.exit(0);
						}
					});
				}
				{
					btReportes = new JButton();
					btReportes.setText("Generar Reportes");
					btReportes.setVisible(false);
					btReportes.addMouseListener(new MouseAdapter() {
						public void mouseClicked(MouseEvent evt) {
							System.out.println("btReportes.mouseClicked, event="+evt);
							//TODO add your code for btnregistrar.mouseClicked
							JFrameReportes PantallaReportes = new JFrameReportes();
							PantallaReportes.setVisible(true);
							//JFrameInicio.setVisible(false);
						}
					});
				}
				{
					jButton1 = new JButton();
					jButton1.setText("jButton1");
					
				}
				{
					brAplicarEval = new JButton();
					brAplicarEval.setText("Aplicar Evaluaciones");
					brAplicarEval.setVisible(false);
					brAplicarEval.addMouseListener(new MouseAdapter() {
						public void mouseClicked(MouseEvent evt) {
							System.out.println("brAplicarEval.mouseClicked, event="+evt);
							//TODO add your code for brAplicarEval.mouseClicked
							if (Seccion.estudiantes.size() > 0)
							{	
								if(s.getProfesor() == null)
								{
									JOptionPane.showMessageDialog(null, "No hay profesor Asignado");
								}
								else
								{
									s.aplicarEvaluaciones();
									JOptionPane.showMessageDialog(null, "Evaluaciones Aplicadas en la Seccion de manera satisfactoria");
								}
									
							}
							else
							{
								JOptionPane.showMessageDialog(null, "No hay estudiantes inscritos en la Seccion");
							}
								
						}
					});
				}
					jPanelSeccionLayout.setHorizontalGroup(jPanelSeccionLayout.createSequentialGroup()
					.addComponent(jButton1, GroupLayout.PREFERRED_SIZE, 6, GroupLayout.PREFERRED_SIZE)
					.addGap(32)
					.addGroup(jPanelSeccionLayout.createParallelGroup()
					    .addGroup(jPanelSeccionLayout.createSequentialGroup()
					        .addComponent(brAplicarEval, GroupLayout.PREFERRED_SIZE, 225, GroupLayout.PREFERRED_SIZE)
					        .addGap(0, 0, Short.MAX_VALUE))
					    .addGroup(GroupLayout.Alignment.LEADING, jPanelSeccionLayout.createSequentialGroup()
					        .addComponent(btEstudiantes, 0, 219, Short.MAX_VALUE)
					        .addGap(6))
					    .addGroup(jPanelSeccionLayout.createSequentialGroup()
					        .addComponent(btReportes, GroupLayout.PREFERRED_SIZE, 225, GroupLayout.PREFERRED_SIZE)
					        .addGap(0, 0, Short.MAX_VALUE))
					    .addGroup(GroupLayout.Alignment.LEADING, jPanelSeccionLayout.createSequentialGroup()
					        .addComponent(btAsigProf, GroupLayout.PREFERRED_SIZE, 169, GroupLayout.PREFERRED_SIZE)
					        .addGap(0, 56, Short.MAX_VALUE)))
					.addGap(7)
					.addGroup(jPanelSeccionLayout.createParallelGroup()
					    .addComponent(lblnroSeccion, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 214, GroupLayout.PREFERRED_SIZE)
					    .addGroup(jPanelSeccionLayout.createSequentialGroup()
					        .addGap(55)
					        .addGroup(jPanelSeccionLayout.createParallelGroup()
					            .addGroup(GroupLayout.Alignment.LEADING, jPanelSeccionLayout.createSequentialGroup()
					                .addComponent(btOk, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
					                .addGap(42))
					            .addGroup(jPanelSeccionLayout.createSequentialGroup()
					                .addGap(24)
					                .addGroup(jPanelSeccionLayout.createParallelGroup()
					                    .addGroup(GroupLayout.Alignment.LEADING, jPanelSeccionLayout.createSequentialGroup()
					                        .addComponent(txtnroSeccion, GroupLayout.PREFERRED_SIZE, 57, GroupLayout.PREFERRED_SIZE)
					                        .addGap(72))
					                    .addGroup(GroupLayout.Alignment.LEADING, jPanelSeccionLayout.createSequentialGroup()
					                        .addPreferredGap(txtnroSeccion, btSalir, LayoutStyle.ComponentPlacement.INDENT)
					                        .addComponent(btSalir, GroupLayout.PREFERRED_SIZE, 117, GroupLayout.PREFERRED_SIZE)))))
					        .addGap(6)))
					.addContainerGap());
					jPanelSeccionLayout.setVerticalGroup(jPanelSeccionLayout.createSequentialGroup()
					.addComponent(jButton1, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)
					.addGap(41)
					.addGroup(jPanelSeccionLayout.createParallelGroup()
					    .addGroup(GroupLayout.Alignment.LEADING, jPanelSeccionLayout.createSequentialGroup()
					        .addComponent(lblnroSeccion, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)
					        .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
					        .addComponent(txtnroSeccion, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
					    .addGroup(GroupLayout.Alignment.LEADING, jPanelSeccionLayout.createSequentialGroup()
					        .addGap(11)
					        .addComponent(btAsigProf, GroupLayout.PREFERRED_SIZE, 38, GroupLayout.PREFERRED_SIZE)))
					.addGap(21)
					.addGroup(jPanelSeccionLayout.createParallelGroup()
					    .addGroup(GroupLayout.Alignment.LEADING, jPanelSeccionLayout.createSequentialGroup()
					        .addComponent(btOk, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					        .addGap(15))
					    .addComponent(btEstudiantes, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 35, GroupLayout.PREFERRED_SIZE))
					.addGap(24)
					.addComponent(brAplicarEval, 0, 35, Short.MAX_VALUE)
					.addGap(31)
					.addGroup(jPanelSeccionLayout.createParallelGroup()
					    .addGroup(GroupLayout.Alignment.LEADING, jPanelSeccionLayout.createSequentialGroup()
					        .addComponent(btReportes, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE)
					        .addGap(7))
					    .addGroup(GroupLayout.Alignment.LEADING, jPanelSeccionLayout.createSequentialGroup()
					        .addGap(12)
					        .addComponent(btSalir, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE)))
					.addContainerGap(28, 28));
			}
			pack();
			this.setSize(506, 356);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}

}
